package com.peanut.util.jdbc.dialect;

public class InformixDialect extends Dialect {
	public boolean supportsLimitOffset(){
		return true;
	}
	
    public boolean supportsLimit() {   
        return true;   
    }  
    
	public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) {
		if ( offset > 0 ) {
			return new StringBuffer( sql.length() + 12 )
				.append( sql )
				.insert( sql.toLowerCase().indexOf( "select" ) + 6, " skip " + offsetPlaceholder + " first " + limit)
				.toString();
		} else {
			return new StringBuffer( sql.length() + 8 )
				.append( sql )
				.insert( sql.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
				.toString();
		}
	}   
}
